import request from '@/utils/request'


// 获取奖励类别List
export function getCategoryList(data) {
  return request({
    url: '/api/prize_category/',
    method: 'get',
    params: data
  })
}

// 新增获奖类别
export function addCategory(data) {
  return request({
    url: '/api/prize_category/',
    method: 'post',
    data: data
  })
}

// 删除获奖类别
export function delCategory(id) {
  return request({
    url: `/api/prize_category/${id}/`,
    method: 'DELETE',
  })
}

// 获取奖励等级List
export function getRankList(data) {
  return request({
    url: '/api/prize_rank/',
    method: 'get',
    params: data
  })
}

// 新增获奖等级
export function addRank(data) {
  return request({
    url: '/api/prize_rank/',
    method: 'post',
    data: data
  })
}

// 删除获奖等级
export function delRank(id) {
  return request({
    url: `/api/prize_rank/${id}/`,
    method: 'DELETE',
  })
}


// 获取奖励级别List
export function getLevelList(data) {
  return request({
    url: '/api/prize_level/',
    method: 'get',
    params: data
  })
}

// 新增获奖级别
export function addLevel(data) {
  return request({
    url: '/api/prize_level/',
    method: 'post',
    data: data
  })
}

// 删除获奖级别
export function delLevel(id) {
  return request({
    url: `/api/prize_level/${id}/`,
    method: 'DELETE',
  })
}

// -------------------------------
// 获取服务的级联格式数据
export function getServeCascader(data) {
  return request({
    url: '/api/institution/service_cascader/',
    method: 'get',
    params: data
  })
}

// 获取服务等级
export function getserve(data) {
  return request({
    url: '/api/institution/service_cascader/',
    method: 'get',
    params: data
  })
}

// 获取惩罚等级
export function getpunishment() {
  return request({
    url: '/api/institution/punishment_cascader/',
    method: 'get'
  })
}
// 添加团队
export function addteam(data) {
  return request({
    url: '/api/team/',
    method: 'post',
    data: data
  })
}

// 删除团队
export function delteam(id) {
  return request({
    url: 'api/team/' + id + '/',
    method: 'DELETE'
  })
}

// 获取团队
export function getteam(data) {
  return request({
    url: '/api/team/',
    method: 'get',
    params: data
  })
}

// 获取团队详情
export function getTeamById(id) {
  return request({
    url: 'api/team/' + id + '/',
    method: 'GET'
  })
}

// 申请加入团队
export function jojnteam(data) {
  return request({
    url: '/api/team/' + data.id + '/join_in/',
    method: 'get'
  })
}
// 修改团队
export function teamchange(id, data) {
  return request({
    url: 'api/team/' + id + '/',
    method: 'PATCH',
    data: data
  })
}

// 为团队申请奖励
export function applyreward(id, data) {
  return request({
    url: '/api/team/' + id + '/apply_reward/',
    method: 'post',
    data: data
  })
}

// 获取制度
export function getRules(data) {
  return request({
    url: '/api/institution/',
    method: 'get',
    params: data
  })
}

// 新增制度
export function addRule(data) {
  return request({
    url: '/api/institution/',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 获取制度详情
export function getRuleDetail(id) {
  return request({
    url: '/api/institution/' + id + '/',
    method: 'get'
  })
}

// 修改制度
export function editRule(data) {
  return request({
    url: '/api/institution/' + data.id + '/',
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 删除制度
export function delRule(data) {
  return request({
    url: '/api/institution/' + data.id + '/',
    method: 'DELETE'
  })
}

// 获取奖励制度级联详情
export function getPrizeCascader(id) {
  return request({
    url: '/api/prize_institution/prize_cascader/',
    method: 'get'
  })
}

// 获取奖励制度级联详情
export function getCompetitionRules(data) {
  return request({
    url: '/api/prize_institution/',
    method: 'get',
    params: data
  })
}

// 获取比赛
export function getCompetition(data) {
  return request({
    url: '/api/prize_competition/',
    method: 'get',
    params: data
  })
}

// 获取奖励制度级联详情
export function getPrizeCategory(data) {
  return request({
    url: '/api/prize_category/',
    method: 'get',
    params: data
  })
}

// 获取奖励制度级联详情
export function getPrizeRank(data) {
  return request({
    url: '/api/prize_rank/',
    method: 'get',
    params: data
  })
}

// 获取奖励制度级联详情
export function getPrizeLevel(data) {
  return request({
    url: '/api/prize_level/',
    method: 'get',
    params: data
  })
}

// 新增比赛奖励制度
export function addCompetitionRule(data) {
  return request({
    url: '/api/prize_institution/',
    method: 'post',
    data: data
  })
}

// 删除比赛奖励制度
export function delCompetitionRule(data) {
  return request({
    url: '/api/prize_institution/' + data.id + '/',
    method: 'delete'
  })
}

// 获取奖励制度级联详情
export function getCompetitionRuleDetail(data) {
  return request({
    url: '/api/prize_institution/' + data.id + '/',
    method: 'get'
  })
}

// 修改奖励制度级联详情
export function editCompetitionRule(data) {
  return request({
    url: '/api/prize_institution/' + data.id + '/',
    method: 'patch',
    data: data
  })
}
